#include<stdio.h>
#include<mpi.h>

int main(int argc, char **argv)
{
	int myid, numprocs;
	MPI_Group group_world;
	int rank_of_group;
	
	MPI_Init(&argc, &argv);
	
	MPI_Comm_rank(MPI_COMM_WORLD, &myid);
    MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
	
	// your code here
    //MPI_Comm_group用来建立一个通信组对应的新进程组
	MPI_Comm_group(MPI_COMM_WORLD, &group_world);
    //MPI_Group_rank查询调用进程在进程组里的rank
	MPI_Group_rank(group_world, &rank_of_group);
	// end of your code
	
	printf("rank: %d\n", rank_of_group);

	MPI_Finalize();
	return 0;
}
